package cn.learn.domain;

import lombok.Getter;
import lombok.Setter;

/**
 * 权限
 * @author huangyezhan
 * @date 2020年01月02日11:45
 */
@Setter
@Getter
public class SysPermission {
    /**
     * 主键
     */
    private Long id;
    /**
     * 编码
     */
    private String permissionCode;
    /**
     * 名称
     */
    private String permissionName;
    /**
     * 访问路径
     */
    private String  url;


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof SysPermission)) {
            return false;
        }

        //对比每一个属性一致,才返回true
        SysPermission that = (SysPermission) o;
        if (getId() != null ? !getId().equals(that.getId()) : that.getId() != null) {
            return false;
        }
        if (getPermissionCode() != null ? !getPermissionCode().equals(that.getPermissionCode()) : that.getPermissionCode() != null) {
            return false;
        }
        if (getPermissionName() != null ? !getPermissionName().equals(that.getPermissionName()) : that.getPermissionName() != null) {
            return false;
        }
        return getUrl() != null ? getUrl().equals(that.getUrl()) : that.getUrl() == null;
    }

    @Override
    public int hashCode() {
        int result = getId() != null ? getId().hashCode() : 0;
        result = 31 * result + (getPermissionCode() != null ? getPermissionCode().hashCode() : 0);
        result = 31 * result + (getPermissionName() != null ? getPermissionName().hashCode() : 0);
        result = 31 * result + (getUrl() != null ? getUrl().hashCode() : 0);
        return result;
    }

}
